package com.ruoyi.lvlian.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.lvlian.dto.LhsWorkStationDto;
import com.ruoyi.lvlian.vo.InvoiceVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.lvlian.domain.LhsWorkStation;
import com.ruoyi.lvlian.service.ILhsWorkStationService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 工作站IOT管理Controller
 *
 * @author ruoyi
 * @date 2025-08-04
 */
@RestController
@RequestMapping("/lhsWorkStation")
@Api(value = "3.3工作站IOT管理", tags = "3.3工作站IOT管理Controller")
public class LhsWorkStationController extends BaseController {
    @Autowired
    private ILhsWorkStationService lhsWorkStationService;

    /**
     * 查询工作站IOT管理列表
     */
    @RequiresPermissions("lvlian:station:list")
    @GetMapping("/list")
    public TableDataInfo list(LhsWorkStationDto lhsWorkStation) {
        startPage();
        List<LhsWorkStation> list = lhsWorkStationService.selectLhsWorkStationList(lhsWorkStation);
        return getDataTable(list);
    }



    /**
     * 获取工作站IOT管理详细信息
     */
//    @RequiresPermissions("lvlian:station:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        LhsWorkStationDto dto =new LhsWorkStationDto();
        dto.setId( id);
        return success(lhsWorkStationService.selectLhsWorkStationById(dto));
    }

    @ApiOperation("根据工作站和用户手机号码查询工作站信息")
    @GetMapping("/getInfoByIdOrUserPhone")
    public AjaxResult getInfoByIdOrUserPhone( LhsWorkStationDto dto ) {
        LhsWorkStation invoiceInfo = lhsWorkStationService.selectLhsWorkStationById(dto);
        return success(invoiceInfo);
    }


    /**
     * 修改工作站IOT管理
     */
    @RequiresPermissions("lvlian:station:edit")
    @Log(title = "工作站IOT管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LhsWorkStation lhsWorkStation) {
        return toAjax(lhsWorkStationService.updateLhsWorkStation(lhsWorkStation));
    }

    /**
     * 删除工作站IOT管理
     */
//    @RequiresPermissions("lvlian:station:remove")
    @Log(title = "工作站IOT管理", businessType = BusinessType.DELETE)
    @PostMapping("/remove")
    public AjaxResult remove(@RequestBody String[] ids) {
        return toAjax(lhsWorkStationService.deleteLhsWorkStationByIds(ids));
    }
}
